package com.example.myapplication;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class Sing_in3 extends AppCompatActivity {

    private Button btn_signup;
    private  Button login;
    private String editUser;
    private String editPass;
    private String user_name;
    private String user_pass;


    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_sing_in3);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        user_name = getIntent().getStringExtra("user");
        user_pass = getIntent().getStringExtra("pass");

       EditText edit_user  =findViewById(R.id.editText_user);



        EditText  edit_pass  =findViewById(R.id.editText_password);





        btn_signup = findViewById(R.id.button_signup);
        btn_signup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(getApplicationContext(), Sign_up3.class);
                startActivity(intent);


            }
        });
       login =findViewById(R.id.button_login);
       login.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {

               editUser = edit_user.getText().toString();
               editPass = edit_pass.getText().toString();
               System.out.println(editUser);
               System.out.println(editPass);

               System.out.println(user_name);

               if(user_name.equals(editUser)&&user_pass.equals(editPass)){
                   Toast.makeText(getApplicationContext(),"登录正确",Toast.LENGTH_LONG).show();
               }



           }
       });



    }
}